﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TarreOA.TarreOABLL;
using TarreOA.TarreOAModels;

public partial class page_NewsIssue : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        User user = new User();
        Section section = new Section();
        section.SectionId = 1;
        user.UserId = 5;
        user.UserName = "flair";
        user.Section = section;
        Session["user"] = user;

    }

    protected void BtnSubmit_Click1(object sender, EventArgs e)
    {
        string Title = TextNewsTitle.Text;
        string Detail = FreeTextBox1.Text;
        Console.WriteLine("aaaa");

        if (!TextNewsTitle.Equals(""))
        {
            if (!Detail.Equals(""))
            {
                int outLineState = 0;
                User user = (User)Session["user"];
                if (CBoxOutLine.Checked)
                {
                    outLineState = 1;
                }
                TarreOA.TarreOABLL.News news = new TarreOA.TarreOABLL.News();
                if (news.insertNews(Title, Detail, user.UserId , user.Section.SectionId , outLineState))
                {
                    Label1.Text = "插入成功";
                }
                else
                {
                    Label1.Text = "插入失败";
                }

            }
            else
            {
                Label1.Text = "新闻内容不能为空";
            }
        }
        else {
            Label1.Text = "新闻标题不能为空";
        }
    }
    protected void BtnCancle_Click(object sender, EventArgs e)
    {

    }
}
